import { defineStore } from "pinia";
import { defaultSetting, setLocalSetting } from "./helper";
import { store } from '@/store/helper'

export const useAppStore = defineStore('app-store', {
    state: defaultSetting,
    actions: {
        setIsMobile(val) {
            this.isMobile = val
        },
        setLanguage(language){
            this.language = language
            setLocalSetting(language)
        },
        switchIsCollapse(){
            this.isCollapse = !this.isCollapse
        }
    },
})

export function useAppStoreWithOut() {
    return useAppStore(store)
}
